/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Factory.DAO;

import Factory.Tables.User;
import java.util.List;

/**
 *
 * @author Patrick
 */
public abstract class UserDAO {
    
    public abstract User authenticate(String username,String password);
    public abstract User adminAuthenticate(String username,String password);
    public abstract void addUser(User newUser);
    public abstract void updateUser(User obj);;
    public abstract void changePassword(int userID,String password);
    public abstract boolean isUsernameUnique(String username);
    public abstract boolean isEmailAddressUnique(String email);
    public abstract boolean isEmailAddressUnique(int userID,String email);
    public abstract User getUser(int userID);
    public abstract List<User> getAllUsers();
    
    
    
    public String encryptPassword(String password){
        if(password!=null){
            char tempPassword[] = password.toCharArray();
            for(int i=0; i< tempPassword.length; i++){
                tempPassword[i]+=3;
            }
            return new String(tempPassword);
        }
        return null;    
    }
    
    public String decryptPassword(String password){
        if(password!=null){
            char tempPassword[] = password.toCharArray();
            for(int i=0; i< tempPassword.length; i++){
                tempPassword[i]-=3;
            }
            return new String(tempPassword);
        }
        return null;
    }
    
    
}
